]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
dateMenu: Show weather location in section header
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 11 Jan 2019 16:42:22 +0000 (17:42 +0100)
committerFlorian Müllner <florian.muellner@gmail.com>
Tue, 5 Feb 2019 11:36:38 +0000 (11:36 +0000)
It is useful information, in particular when the location is set
automatically via geoclue.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/262

data/theme/gnome-shell-sass/_common.scss
js/ui/dateMenu.js

index 801792fa35f09fd1f6f26347f9d1e92cfe62e725..d952f1427900870db186bfaa35440e5a2555b92a 100644 (file)
@@ -922,6 +922,11 @@ StScrollBar {
       font-weight: bold;
     }
 
+    .weather-header.location {
+      font-weight: normal;
+      font-size: 0.9em;
+    }
+
     .world-clocks-grid,
     .weather-grid {
       spacing-rows: 0.4em;
index c87df8de20d87439498a9e820291c3442917f38d..0a6f267e7ac9051201b77486a5c2bd1972dbc928 100644 (file)
@@ -218,9 +218,16 @@ var WeatherSection = class WeatherSection {
 
         this.actor.child = box;
 
-        box.add_child(new St.Label({ style_class: 'weather-header',
-                                     x_align: Clutter.ActorAlign.START,
-                                     text: _("Weather") }));
+        let titleBox = new St.BoxLayout();
+        titleBox.add_child(new St.Label({ style_class: 'weather-header',
+                                          x_align: Clutter.ActorAlign.START,
+                                          x_expand: true,
+                                          text: _("Weather") }));
+        box.add_child(titleBox);
+
+        this._titleLocation = new St.Label({ style_class: 'weather-header location',
+                                             x_align: Clutter.ActorAlign.END });
+        titleBox.add_child(this._titleLocation);
 
         let layout = new Clutter.GridLayout({ orientation: Clutter.Orientation.VERTICAL });
         this._forecastGrid = new St.Widget({ style_class: 'weather-grid',
@@ -302,12 +309,14 @@ var WeatherSection = class WeatherSection {
             return;
         }
 
+        let info = this._weatherClient.info;
+        this._titleLocation.text = info.get_location().get_name();
+
         if (this._weatherClient.loading) {
             this._setStatusLabel(_("Loading…"));
             return;
         }
 
-        let info = this._weatherClient.info;
         if (info.is_valid()) {
             this._addForecasts();
             return;
@@ -325,6 +334,8 @@ var WeatherSection = class WeatherSection {
         if (!this.actor.visible)
             return;
 
+        this._titleLocation.visible = this._weatherClient.hasLocation;
+
         this._updateForecasts();
     }
 };